package com.xx.sg.own.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xx.sg.own.entity.User;
import com.xx.sg.own.mapper.UserMapper;
import com.xx.sg.own.service.UserService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> selectUsersByDept(String deptId) {
        return userMapper.usersByDept(deptId);
    }

    @Override
    public List<User> selectUserByName(String name) {
        LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(User::getIsDelete, 1)
                .eq(User::getRealName, name);
        return userMapper.selectList(wrapper);
    }

    @Override
    public List<User> selectUsersByDeptId(String deptId) {
        return userMapper.selectUsersByDeptId(deptId);
    }
}
